﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Sgr.DataCategories.Services
{
    /// <summary>
    /// 数据字典查询接口
    /// </summary>
    public interface ICategoryItemsQuery
    {
        /// <summary>
        /// 异步获取指定类别和键的数据字典项
        /// </summary>
        /// <param name="category">数据字典类别</param>
        /// <param name="key">数据字典键</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>数据字典项</returns>
        Task<NameValue?> GetItemAsync(string category,
            string key,
            CancellationToken cancellationToken = default);

        /// <summary>
        /// 异步获取指定类别的所有数据字典项
        /// </summary>
        /// <param name="category">数据字典类别</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>数据字典项的只读字典</returns>
        Task<IReadOnlyDictionary<string, NameValue>> GetCategoryAsync(string category,
            CancellationToken cancellationToken = default);
    }
}